import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios';//axios
import ElementUI from 'element-ui';//引入ElementUI
import 'element-ui/lib/theme-chalk/index.css';//ElementUI默认主题
import echarts from 'echarts';// 引入echarts

import com from './components/common/com';//全局变量

Vue.prototype.$echarts = echarts;
Vue.prototype.$axios = axios;
Vue.use(ElementUI, {size: 'small'});
Vue.config.productionTip = false;

Vue.prototype.$com = com;//全局变量

/*富文本编辑器*/
import '../static/ue/ueditor.config.js'
import '../static/ue/ueditor.all.min.js'
import '../static/ue/lang/zh-cn/zh-cn.js'
import '../static/ue/ueditor.parse.min.js'


router.beforeEach((to, from, next) => {
  const role = localStorage.getItem('ms_username');
  if (!role && to.path !== '/login') {
    next('/login');
  } else {
    next();
  }
});

new Vue({
  router,
  render: h => h(App)
}).$mount('#app');
